package com.hnit.rol.order.controller.admin;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnit.rol.commonutils.Result;
import com.hnit.rol.model.entity.order.OrderInfo;
import com.hnit.rol.model.vo.order.OrderQueryCondition;
import com.hnit.rol.order.service.IOrderInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author King
 * @since 2023-04-08
 */
@Api(tags = "订单后台api接口")
@RestController
@RequestMapping("admin/order/payOrder")
public class PayOrderAdminController {
    @Resource
    private IOrderInfoService orderService;

    @ApiOperation(value = "分页查询订单信息")
    @PostMapping("pageQueryOrder/{index}/{limit}")
    public Result pageQueryOrder(
            @ApiParam(name = "index", value = "当前页", required = true)
            @PathVariable Long index,
            @ApiParam(name = "limit", value = "每页记录数", required = true)
            @PathVariable Long limit,
            @ApiParam(name = "queryCondition", value = "查询条件", required = true)
            @Validated @RequestBody OrderQueryCondition queryCondition) {
        Page<OrderInfo> orderList = orderService.pageQueryOrder(index, limit, queryCondition);
        return Result.success(orderList);
    }

}
